package com.zhouyx.userservice.config;

import com.zhouyx.userservice.service.TestServiceA;
import com.zhouyx.userservice.service.TestServiceB;
import com.zhouyx.userservice.service.interfaces.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @title: TestServiceConfig
 * @Author: max.zhou1
 * @Date: 2024/9/10 17:37
 * @Version: 1.0
 **/
@Configuration
public class TestServiceConfig {
    @Autowired
    private Region region;

    @Bean
    public TestService testService() {
        if (region.getServiceUser().equals("zues")) {
            return new TestServiceA();
        }
        return new TestServiceB();
    }
}
